package com.mallcloud.mall.app.api.entity.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.mallcloud.mall.common.core.constant.enums.app.WxPayEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@ApiModel(value = "WxPay3NotifyRefundDataVO", description = "微信3退款通知解密数据")
@Data
public class WxPay3NotifyRefundDataVO implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("直连商户号")
	@JSONField(name = "mchid")
    private String mchId;

	@ApiModelProperty("商户订单号")
	@JSONField(name = "out_trade_no")
    private String outTradeNo;

	@ApiModelProperty("微信支付订单号")
	@JSONField(name = "transaction_id")
    private String transactionId;

	@ApiModelProperty("商户退款单号")
	@JSONField(name = "out_refund_no")
    private String outRefundNo;

	@ApiModelProperty("微信支付退款单号")
	@JSONField(name = "refund_id")
    private String refundId;

	/**
	 * {@link WxPayEnum.RefundStateEnum}
	 */
	@ApiModelProperty("退款状态")
	@JSONField(name = "refund_status")
    private String refundStatus;

	public Boolean isSuccess(){
		return WxPayEnum.RefundStateEnum.SUCCESS.name().equals(this.refundStatus);
	}

	@ApiModelProperty("退款成功时间")
	@JSONField(name = "success_time")
    private String successTime;

	@ApiModelProperty("退款入账账户")
	@JSONField(name = "user_received_account")
    private String userReceivedAccount;

	@ApiModelProperty("订单金额")
    private Amount amount;


	@ApiModel(value = "Amount", description = "微信3退款-订单金额")
	@Data
	public static class Amount implements Serializable {
		private static final long serialVersionUID = 1L;

		@ApiModelProperty("订单总金额")
		private Long total;//分

		@ApiModelProperty("退款金额")
		private Long refund;//分

		@ApiModelProperty("用户支付金额")
		@JSONField(name = "payer_total")
		private Long payerTotal;

		@ApiModelProperty("用户退款金额")
		@JSONField(name = "payer_refund")
		private Long payerRefund;
	}
}
